home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994…tember: Reference Library / Dev.CD Sep 94.toast / Periodicals / develop / develop Issue 18 / develop 18 code / OSA Sample / Sources / AESubDescs.h < prev    next >
Encoding:
Text File  |  1992-09-17  |  1.9 KB  |  59 lines  |  [TEXT/KAHL]

  1. // AESubDescs.h
  2. //
  3. // A high-efficiency way to examine AEDescs. Everything is done in place, without any
  4. // copying of data, which avoids most of the overhead of the Apple Event Manager.
  5. //
  6. // By Jens Alfke; Copyright ©1992 Apple Computer. All Rights Reserved.
  7.  
  8.  
  9. #ifdef THINK_C
  10. #pragma once                                        /* For THINK C users */
  11. #endif
  12.  
  13. #ifndef __AESUBDESCS__
  14. #define __AESUBDESCS__                                /* For poor MPW users :) */
  15.  
  16. #include <AppleEvents.h>
  17.  
  18. enum{                                                // Error code
  19.     errAEListIsFactored        = -1760                        // I cannot get data from factored lists
  20. };
  21.  
  22.  
  23. typedef struct {
  24.     DescType    subDescType;        // Type of this subDesc. You may read this field.
  25.     Handle        dataHandle;            // Handle to main (outer) descriptor. Private.
  26.     long        offset;                // Offset into main descriptor where subDesc starts. Private.
  27. } AESubDesc;
  28.  
  29.  
  30. pascal void
  31.     AEDescToSubDesc( const AEDesc*, AESubDesc* );                    // Create subDesc on desc
  32. pascal OSErr
  33.     AESubDescToDesc( const AESubDesc*, long desiredType, AEDesc* );    // Copy subDesc to new desc
  34.  
  35. pascal DescType
  36.     AEGetSubDescType( const AESubDesc* );                            // Same as ->subDescType
  37. pascal void*
  38.     AEGetSubDescData( const AESubDesc*, long *length );                // Invalid once dataHandle moves
  39.  
  40. pascal Boolean
  41.     AESubDescIsListOrRecord( const AESubDesc* sd );    // Is it a list or (possibly coerced) record?
  42. pascal DescType
  43.     AEGetSubDescBasicType( const AESubDesc* );        // Returns 'reco' if it's a coerced record
  44.  
  45. // The list-oriented calls that follow make sure the subdescriptor is a valid list or (possibly
  46. // coerced) record. If not, they'll return errAEWrongDataType.
  47.  
  48. pascal long
  49.     AECountSubDescItems( const AESubDesc* );
  50.  
  51. // In these next two calls, it's okay if newSD == sd; sd will be overwritten with the new subDesc.
  52.     
  53. pascal OSErr
  54.     AEGetNthSubDesc( const AESubDesc* sd, long index,
  55.                      AEKeyword* keyIfAny, AESubDesc* newSD ),
  56.     AEGetKeySubDesc( const AESubDesc* sd, AEKeyword,                // Lists illegal here
  57.                      AESubDesc* newSD );
  58.  
  59. #endif